define(function(require){
	var $ = require("jquery");
	var justep = require("$UI/system/lib/justep");
	
	var Model = function(){
		this.callParent();
		this.url = "http://yun.jiawoltd.com";
		//this.url = "http://127.0.0.1:8888";
	};

	Model.prototype.modelLoad = function(event){
		var baseData = this.comp("baseData");
		var userId = localStorage.getItem("USER_ID");
		var ajaxCallUrl = this.url + "/mobile/getOrg/0/"+userId;
		$.ajax({
			cache : false,
			type : "GET",
			timeout : 10000, // 超时时间设置，单位毫秒
			url : ajaxCallUrl,
			data : {},
			async : false,
			error : function(request) {
			},
			success : function(data) {
				baseData.clear();
				baseData.loadData(data);
			}
		});
		
		
	};

	Model.prototype.scrollView1PullDown = function(event){
		var baseData = this.comp("baseData");
		var userId = localStorage.getItem("USER_ID");
		var ajaxCallUrl = this.url + "/mobile/getOrg/0/"+userId;
		$.ajax({
			cache : false,
			type : "GET",
			timeout : 10000, // 超时时间设置，单位毫秒
			url : ajaxCallUrl,
			data : {},
			async : false,
			error : function(request) {
			},
			success : function(data) {
				baseData.clear();
				baseData.loadData(data);
			}
		});
	};


	Model.prototype.media1Click = function(event){
		justep.Shell.setIsSinglePage();
		var url = './jd/jd.w';
		if(!event.bindingContext.$object.val('haveSubs')){
			url = './detail/detail.w';
		}
		justep.Shell.showPage(require.toUrl(url), {
			id : event.bindingContext.$object.val('id')
		});
	};


	Model.prototype.listTemplateUl1Click = function(event){

	};


	return Model;
});